package com.cxrj.zhsq.userManage.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.cxrj.zhsq.userManage.entity.SystemMessage;
import com.cxrj.zhsq.userManage.service.SystemMessageService;

@RestController
@RequestMapping("/systemMessage")
public class SystemMessageController {
	
	@Resource
	private SystemMessageService systemMessageService;
	
	/**
	 * 查询所有
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "selectSystemMessagePage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public Map<String, Object> selectSystemMessagePage(HttpServletRequest request,HttpServletResponse response){
		return systemMessageService.selectSystemMessagePage(request,response);
	}
	
	/**
	 * 插入数据
	 * @param systemMessage
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("insertSystemMessage")
	public Map<String, Object> insertSystemMessage(SystemMessage systemMessage,HttpServletRequest request,HttpServletResponse response){
		return systemMessageService.insertSystemMessage(systemMessage,request,response);
	}
	
	/**
	 * 根据ID查询
	 * @param systemMessage
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("selectSystemMessageById")
	public Map<String, Object> selectSystemMessageById(SystemMessage systemMessage,HttpServletRequest request,HttpServletResponse response){
		String id=systemMessage.getSmId();
		String userId="";
		return systemMessageService.selectSystemMessageById(id, userId, request);
	}
	
	/**
	 * 更新数据
	 * @param systemMessage
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping("updateSystemMessage")
	public Map<String, Object> updateSystemMessage(SystemMessage systemMessage,HttpServletRequest request,HttpServletResponse response){
		return systemMessageService.updateSystemMessage(systemMessage,request,response);
	}
	
	@RequestMapping("deleteSystemMessage")
	public Map<String, Object> deleteSystemMessage(String smId,HttpServletRequest request,HttpServletResponse response){
		return systemMessageService.deleteSystemMessage(smId,request,response);
	}

}
